//
// Created by 谢哲 on 2021/5/13.
//

#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    int k;
    cin >> s >> k;
    if (s.length()==k) {
        cout << 0;
        return 0;
    }

    for(;k;--k) {
        auto len = s.length();
        for (int i=0;i<len;++i) {
            if (i==len-1) {
                s.erase(i, 1);
                break;
            }
            if (s[i] > s[i+1]) {
                s.erase(i, 1);
                break;
            }
        }
    }

    auto p = s.find_first_not_of('0');
    if (p < s.length()) {
        s = s.substr(p);
    }
    else {
        s = "0";
    }

    cout << s;

    return 0;
}